package top.wherewego.vnt.view;

import android.view.View;

import androidx.annotation.NonNull;

import top.wherewego.vnt.bean.Conf;
import top.wherewego.vnt.databinding.ItemConfListBinding;

public class ConfigListHolder extends BaseHolder<Conf> {

    private ItemConfListBinding binding;

    public ConfigListHolder(View itemView) {
        super(itemView);
        binding = ItemConfListBinding.bind(itemView);
    }

    @Override
    public void setData(@NonNull Conf data, int position) {
        binding.name.setText(data.getConName());
        if (data.getServer() == null || data.getServer().equals("")) {
            binding.server.setText("默认服务器");
        } else {
            binding.server.setText(data.getServer());
        }
        binding.token.setText(data.getToken());
        binding.delete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mOnViewClickListener.onViewClick(binding.delete, position);
            }
        });
    }
}
